package hudongchuangxiang.com.roateimg;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final RoateImg roateImg = (RoateImg) findViewById(R.id.roateImg);
//        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.mine_head);
//        roateImg.setImageBitmap(bitmap);
        Glide.with(MainActivity.this)
                .load("http://img5.imgtn.bdimg.com/it/u=2495737782,840417959&fm=27&gp=0.jpg")
                .asBitmap()
                .placeholder(R.mipmap.ic_launcher)
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        roateImg.setImageBitmap(resource);
                    }
                });
    }
}
